<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/doc/src/emb-porting.qdoc -->
<head>
  <title>Qt 4.3: Porting Qtopia Core to Another Operating System</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">Porting Qtopia Core to Another Operating System<br /><small></small></h1>
<p><a href="qtopiacore.html">Qtopia Core</a> is reasonably platform-independent, making use of the standard C library and some POSIX functions, but only a Linux implementation is publically available. If you are looking for a non-Linux commercial implementation, it is worth contacting <a href="mailto:sales@trolltech.com">sales@trolltech.com</a> to see if we can help.</p>
<p>There are several issues to be aware of if you plan to do your own port to another operating system. In particular you must resolve <a href="qtopiacore.html">Qtopia Core</a>'s shared memory and semaphores (used to share window regions), and you must provide something similar to Unix-domain sockets for inter-application communication. You must also provide a screen driver, and if you want to implement sound you must provide your own sound server. Finally you must modify <a href="qtopiacore.html">Qtopia Core</a>'s event dispatcher.</p>
<p>Contents:</p>
<ul><li><a href="#shared-memory-and-semaphores">Shared Memory and Semaphores</a></li>
<li><a href="#inter-application-communication">Inter-Application Communication</a></li>
<li><a href="#screen-management">Screen Management</a></li>
<li><a href="#sound-management">Sound Management</a></li>
<li><a href="#event-dispatching">Event Dispatching</a></li>
</ul>
<a name="shared-memory-and-semaphores"></a>
<h2>Shared Memory and Semaphores</h2>
<p><a href="qtopiacore.html">Qtopia Core</a> uses System V IPC (shared memory and semaphores) to share window regions between client and server. When porting, something similar must be provided; otherwise it will not be possible to run multiple applications.</p>
<p>System V semaphores are also used for synchronizing access to the framebuffer.</p>
<ul>
<li>Modify <tt>qsharedmemory_p.cpp</tt></li>
<li>Modify <tt>qlock_qws.cpp</tt></li>
<li>Modify <tt>qwslock.cpp</tt></li>
</ul>
<a name="inter-application-communication"></a>
<h2>Inter-Application Communication</h2>
<p>To communicate between applications, <a href="qtopiacore.html">Qtopia Core</a> uses the Unix-domain sockets. When porting, something similar must be provided; otherwise it will not be possible to run multiple applications.</p>
<p>It should be possible to use message queues or similar mechanisms to achieve this. With the exception of QCOP messages, individual messages should be no more than a few bytes in length (QCOP messages are generated by the client applications and not Qtopia Core).</p>
<ul>
<li>Modify <tt>qwssocket_qws.cpp</tt></li>
</ul>
<a name="screen-management"></a>
<h2>Screen Management</h2>
<p>When rendering, <a href="qtopiacore.html">Qtopia Core</a>'s default behavior is for each client to render its widgets into memory while the server is responsible for putting the contents of the memory onto the screen using the screen driver.</p>
<p>When porting, a new screen driver must be implemented, providing a byte pointer to a memory-mapped framebuffer and information about width, height and bit depth (the latter information can most likely be hard-coded).</p>
<ul>
<li>Reimplement <tt>qscreen_qws.cpp</tt></li>
</ul>
<a name="sound-management"></a>
<h2>Sound Management</h2>
<p>To implement sound, <a href="qtopiacore.html">Qtopia Core</a> uses a Linux style device (<tt>/dev/dsp</tt>). If you want to use the <a href="qtopiacore.html">Qtopia Core</a> sound server on another platform you must reimplement it.</p>
<ul>
<li>Reimplement <tt>qsoundqss_qws.cpp</tt></li>
</ul>
<a name="event-dispatching"></a>
<h2>Event Dispatching</h2>
<p><a href="qtopiacore.html">Qtopia Core</a> uses an event dispatcher to pass events to and from the <a href="qtopiacore.html">Qtopia Core</a> server application. Reimplement the <tt>select()</tt> function to enable <a href="qtopiacore.html">Qtopia Core</a> to dispatch events on your platform.</p>
<ul>
<li>Modify <tt>qeventdispatcher_qws.cpp</tt></li>
</ul>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
